<?php 
	require_once("utils.php");
	require_once("obj/session.php");
	require_once("obj/user.php");
	require_once("obj/project.php");
		
	$projects = Project::getForUser($session->UserId);
?>
<a href="<?php echo Utils::makeProjectDetailUrl(0); ?>">New</a>
<table class="datatable" width="100%" cellpadding="5" cellspacing="0">
<tr><th>Name</th><th>Description</th><th>Created</th><th>Modified</th><th>&nbsp;</th></tr>
<?php
	$ix = 0;
	foreach($projects as $p){
		$i = $p->ProjectId;
		$n = $p->Name;
		$d = $p->Description;
		$c = $p->Created;
		$m = $p->Modified;
		$u = Utils::makeProjectDetailUrl($i);
		$cs = $ix % 2 == 0 ? "row" : "altrow";
		echo "<tr class=\"$cs\"><td>$n</a></td><td>$d</td><td>$c</td><td>$m</td><td><a href=\"$u\">Edit</a></td></tr>";
		$ix++;
	}
?>
</table>
<?php echo count($projects)." rows"; ?>